<div class="container">
  <div class="bg-putih">
    <div class="jdl-page">
      <?php echo $judul ?>
      <div class="clearfix"></div>
    </div>
    <div class="row">
      <div class="col-xs-3">
        <div class="form-group">
          <label class="col-xs-5 control-label">Petugas</label>
          <div class="col-xs-7">
            <?php echo $data['nickname']; ?>
          </div>
        </div>
      </div>
    </div>
    <div class="row">
      <div class="col-xs-3">
        <div class="form-group">
          <label class="col-xs-5 control-label">Tanggal</label>
          <div class="col-xs-7">
            <?php echo id_date($data['Tanggal'], 'long'); ?>
          </div>
        </div>
      </div>
    </div>
    <br>
    <table class="table table-hover">
      <tr>
        <th width="5%">#</th>
        <th width="10%">Kode</th>
        <th width="30%">Nama Obat</th>
        <th width="15%">Jumlah</th>
        <th width="15%">Harga</th>
        <th width="15%">Total</th>
      </tr>
      <tbody id="beli-add-cont">
        <?php 
          $no = 1;
          $grand_total = 0;
          foreach($detail_jual as $value): ?>
          <tr>
            <td><?php echo $no++; ?></td>
            <td><?php echo $value['KdObat'] ?></td>
            <td><?php echo $value['NmObat'] ?></td>
            <td><?php echo $value['Jumlah'] ?></td>
            <td><?php echo formatRupiahTabel($value['Harga']); ?></td>
            <td><?php echo formatRupiahTabel($total = $value['Jumlah'] * $value['Harga']); ?></td>
          </tr>
        <?php 
          $grand_total = $grand_total + $total;
          endforeach; 
        ?>
        <?php if(count($detail_jual) > 0): ?>
          <tr>
            <td colspan="5">Grand Total</td>
            <td><b><?php echo formatRupiahTabel($grand_total); ?></b></td>
          </tr>
        <?php endif; ?>

        <?php if(count($detail_jual) == 0): ?>
          <tr>
            <td align="center" colspan="6">Tidak ada detail pembelian</td>
          </tr>
        <?php endif; ?>
    </tbody>
    <tfoot>
      <tr>
        <td colspan="3">
          <br>
          <b>Keterangan :</b>
          <div class="keterangan-detail-penjualan">
          <?php echo $data['Keterangan']; ?>
          </div>
        </td>
        <td colspan="3"></td>
      </tr>
    </tfoot>
  </table>
  </div>
</div>